package com.director.struts;

import com.director.core.DirectMethod;
import com.opensymphony.xwork2.ActionContext;
import org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor;

import java.lang.reflect.Method;

/**
 */
public class DirectAnnotationValidationInterceptor extends AnnotationValidationInterceptor {

   @Override
   protected Method getActionMethod(Class actionClass, String methodName) throws NoSuchMethodException {

      ActionContext invocationContext = ActionContext.getContext().getActionInvocation().getInvocationContext();
      DirectMethod actionMethod = (DirectMethod) invocationContext.get(DirectActionInvocation.DIRECT_METHOD);
      return actionMethod.getMethod();
   }
}
